package abstractEntities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import entities.Language;
import entities.Lesson;
import entitiesIds.LanguagelessonId;

/**
 * AbstractLanguagelesson entity provides the base persistence definition of the
 * Languagelesson entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractLanguagelesson implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 8004696108476127460L;
	private LanguagelessonId id;
	private Lesson lesson;
	private Language language;
	private String name;
	private String description;

	// Constructors

	/** default constructor */
	public AbstractLanguagelesson() {
	}

	/** full constructor */
	public AbstractLanguagelesson(LanguagelessonId id, Lesson lesson,
			Language language, String name, String description) {
		this.id = id;
		this.lesson = lesson;
		this.language = language;
		this.name = name;
		this.description = description;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idLesson", column = @Column(name = "idLesson", nullable = false)),
			@AttributeOverride(name = "abb", column = @Column(name = "abb", nullable = false, length = 5)) })
	public LanguagelessonId getId() {
		return this.id;
	}

	public void setId(LanguagelessonId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idLesson", nullable = false, insertable = false, updatable = false)
	public Lesson getLesson() {
		return this.lesson;
	}

	public void setLesson(Lesson lesson) {
		this.lesson = lesson;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "abb", nullable = false, insertable = false, updatable = false)
	public Language getLanguage() {
		return this.language;
	}

	public void setLanguage(Language language) {
		this.language = language;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", nullable = false, length = 1500)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

}